<template>
	<view class="layout">
		<uni-header :title="'添加笔记'"></uni-header>
		<view class="content">
			<view class="evaluate">
				<view class="evaluate-list">
					<text class="title-text">笔记名称</text>
					<u-input v-model="addNote.note_name" type="text" placeholder="请输入笔记名称" input-align="right"
						border="false" />
				</view>
				<view class="evaluate-list">
					<text class="title-text">笔记分类</text>
					<view class="right-text">默认分类</view>
					<!--                    <u-input v-model="addNote.activity_id" type="text" placeholder="请输入授课类型" input-align="right" border="false" />-->
				</view>
				<view class="evaluate-list">
					<text class="title-text">笔记内容</text>
				</view>
				<view class="evaluate-list">
					<uni-easyinput type="textarea" v-model="addNote.comment" placeholder="请输入笔记内容" />
				</view>
			</view>
			<u-button type="primary" @click="addNoteData">保存</u-button>
		</view>
	</view>
</template>

<script>
	import {
		addNote
	} from '@/api/note'
	export default {
		data() {
			return {
				addNote: {
					note_name: "",
					comment: "",
					video_urt: "",
					activity_id: "默认分类",
					deviceId: this.$store.state.user.deviceId
				}
			}
		},
		methods: {
			addNoteData() {
				uni.showLoading({
					title: '正在保存笔记'
				})
				addNote(this.addNote).then(res => {
					uni.hideLoading();
					if (res.status == 0) {
						uni.$u.toast('保存成功');
						setTimeout(() => {
							this.$tab.reLaunch('/pages/mine/note/note')
						}, 2000);
					} else {
						uni.$u.toast(res.result);
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f5f6f7;

		.content {
			.evaluate {
				background: #fff;
				margin-bottom: 15px;

				.evaluate-list {
					display: flex;
					justify-content: space-between;
					align-items: center;
					border-bottom: 1px solid #ddd;
					padding: 10px 15px;

					.left-title {
						width: 20vw;
					}

					.right {
						width: 80vw;
						text-align: right;
					}
				}
			}
		}
	}
</style>